#ifndef SERVER_H
#define SERVER_H
#include "Listener.h"
#include <boost\thread.hpp>
#include <boost\asio.hpp>
#include "Message.h"

using namespace boost;
using boost::asio::ip::tcp;
///Server.
class Server
{
public:
	/** */
	Server(checkfuntype fun):endpoint(tcp::v4(), 7590),listener(iosev,endpoint,fun,room){}
	/** */
	void start()
	{
		boost::thread(boost::bind(&boost::asio::io_service::run,&iosev));
	}
	/** */
	void broadcast(MyMsg& m)
	{
		room.broadcast(m);
	}
private:
	boost::asio::io_service iosev;
	tcp::endpoint endpoint;
	Listener listener;
	Room room;
};

#endif